home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / EGAVGA.SWG / 0080_Fast VGA Routines.pas < prev    next >
Pascal/Delphi Source File  |  1994-01-27  |  3KB  |  110 lines

  1. {
  2. I've must say that im not exactly the perfect programmer, but I think I've an
  3. answer to some of your questions.
  4.  
  5. 1. Well to post a whole program who does that is quite complicated. But
  6.    if you use the Pelpanning register it's possible to create really fast
  7.    scrollers even on slow 286 and XT's. Here comes a simple proc just to
  8.    get the Idea:
  9.  
  10. }
  11.  
  12. const Crtadress:word=$3d4;
  13.       Inputstatus:word=$3DA;
  14.  
  15.  
  16. Procedure Pan(X,Y: Word);assembler;    { This pans the screen } asm
  17.     mov    bx,320
  18.     mov    ax,y
  19.     mul    bx
  20.     add    ax,x
  21.     push   ax
  22.     pop    bx
  23.     mov    dx,INPUTSTATUS
  24. @WaitDE:
  25.     in     al,dx
  26.     test   al,01h
  27.     jnz    @WaitDE       {display enable is active?}
  28.     mov    dx,Crtadress
  29.     mov    al,$0C
  30.     mov    ah,bh
  31.  
  32.     out    dx,ax
  33.     mov    al,$0D
  34.     mov    ah,bl
  35.     out    dx,ax
  36.     MOV    dx,inputstatus
  37. @wait:
  38.     in      al,dx
  39.     test    al,8                    {?End Vertical Retrace?}
  40.     jz     @wait
  41. End;
  42.  
  43. {
  44. If you use this, you should realize that if you increase x by one the screen
  45. moves four pixels. This procedure move the whole screen, so if you want a logo
  46. or something at the screen too you have to use this little procedure, it resets
  47. the scanlines at the screen soo it is only the top of the screen that moves.
  48. }
  49.  
  50. procedure vgasplit(whatline:word);
  51. begin
  52.   asm
  53. {VGASplit        Proc    Near}
  54.                  Mov     BX,whatline
  55.                  Mov     DX,3DAh-6           {; Port = 3D4H}
  56.                  Mov     AX,BX
  57.                  Mov     BH,AH
  58.                  Mov     BL,BH
  59.                  And     BX,0201H
  60.                  Mov     CL,4
  61.                  Shl     BX,CL
  62.                  Shl     BH,1
  63.                  Mov     AH,AL
  64.                  Mov     AL,18H
  65.                  Out     DX,AX
  66.  
  67.                  Mov     AL,7
  68.                  Out     DX,AL
  69.  
  70.                  Inc     DX
  71.                  In      AL,DX
  72.  
  73.                  Dec     DX
  74.                  Mov     AH,AL
  75.                  And     AH,11101111B
  76.                  Or      AH,BL
  77.                  Mov     AL,7
  78.                  Out     DX,AX
  79.  
  80.                  Mov     AL,9
  81.                  Out     DX,AL
  82.  
  83.                  Inc     DX
  84.                  In      AL,DX
  85.  
  86.                  Dec     DX
  87.                  Mov     AH,AL
  88.                  And     AH,10111111B
  89.                  Or      AH,BH
  90.                  Mov     AL,9
  91.                  Out     DX,AX
  92.  
  93.                End;
  94. end;
  95.  
  96. {
  97. 2. There are several unit's out there that comes with source so i suggest
  98.    that you have another look at one of them, There is a really nice one
  99.    called ANIVGA.
  100.  
  101. 3. Well its almost the same as the first question. Just dont set the vgasplit
  102.    rutine. And increase the y parameter instead of x.
  103.  
  104.  
  105. All of the rutines have been written for mode X, but it's also possible to use
  106. them with standard Vgamode $13.
  107. Thats it. I really hope it helped you or/and somebody else a little bit,if you
  108. or anyone else have any questions. Please feel free to write me a Letter.
  109.  
  110. }